#Title: How to Run an External JavaScript

Sometimes you might want to run the same script on several pages, without writing the script on each and every page.

To simplify this you can write a script in an external file, and save it with a .js file extension, like this:

document.write("This script is external")

Save the external file as xxx.js.

Note: The external script cannot contain the <script> tag

Now you can call this script, using the "src" attribute, from any of your pages:

<html>
<head>
</head>
<body>
<script src="xxx.js"></script>
</body>
</html>

Remember to place the script exactly where you normally would write the script

#Title: JavaScript Where To ...
#Element: 78: JavaScript Where To ...